package cl.foursoft.sensordaemon.properties;

import java.io.File;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Properties;

public class Propiedades {

	public static final String FS = File.separator;
	public static final String CONF_PATH = System.getProperty("catalina.base") + FS + "conf";
	public static final String TMP_PATH = System.getProperty("catalina.base") + FS + "tmp";
	public static String JNDI_NAME = "";

	private static HashMap<String, String> parametros = new HashMap<String,String>();

	static{
		try {

			String path = "/cl/foursoft/sensordaemon/properties/aplication.properties";
			InputStream in = Propiedades.class.getResourceAsStream(path);			
			Properties props = new Properties();    
			props.load(in);

			JNDI_NAME = props.getProperty("JNDI_NAME");

			System.out.println("Properties cargado");

		}catch (Exception e){
			System.out.println("catch clase Properties");
			e.printStackTrace();
		}
	}

	static public String getProperty(String nombre){
		String ret = "";
		if(parametros.containsKey(nombre))
			ret = parametros.get(nombre);

		return ret;
	}  
}
